package com.huawei.appgallery.appcomment.ui.view;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSViewProxy;
import com.huawei.appgallery.foundation.ui.css.RenderListener;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import o.bcg.c;
import o.epo;

public class FavoriteImageView extends ImageView implements RenderListener {
    private Drawable ॱ;

    public FavoriteImageView(Context context) {
        super(context);
    }

    public FavoriteImageView(Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
        ˊ(context);
    }

    public FavoriteImageView(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ˊ(context);
    }

    private void ˊ(Context context) {
        this.ॱ = context.getResources().getDrawable(c.ˋ);
    }

    public boolean onRenderReady(CSSViewProxy cSSViewProxy) {
        CSSRule rule = cSSViewProxy.getRule();
        if (rule.getStyleDeclaration() == null) {
            return false;
        }
        CSSValue propertyValue = rule.getStyleDeclaration().getPropertyValue(CSSPropertyName.BACKGROUND_TINT);
        if (!(propertyValue instanceof CSSMonoColor)) {
            return false;
        }
        this.ॱ = epo.ॱ(this.ॱ, ((CSSMonoColor) propertyValue).getColor());
        setBackground(this.ॱ);
        return true;
    }
}
